package com.example.umeng_sdk;


import android.app.Application;
import com.meituan.android.walle.WalleChannelReader;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

public class UmengManager {

    private Application context;

    private UmengManager(){}
    private static UmengManager instance;

    public static UmengManager getInstance() {
        if (instance ==null){
            instance = new UmengManager();
        }
        return instance;
    }
    public void initUM(Application context){
        this.context = context;
        String channel ="";
        channel = WalleChannelReader.getChannel(context);
        if (channel==null)
            channel = "test";

        UMConfigure.setLogEnabled(true);
        UMConfigure.init(context, UmengConst.UMENGKEY,  channel, UMConfigure.DEVICE_TYPE_PHONE,
                UmengConst.UMENGSECRET);
        PlatformConfig.setSinaWeibo(UmengConst.SINALKEY,UmengConst.SINASECRET,UmengConst.SINABACKURL);
        PlatformConfig.setSinaFileProvider("com.mooc.ppjoke.fileprovider");
        MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.MANUAL);


    }

}
